package com.zhongkeruan.user;

import com.zhongkeruan.common.utils.JwtUtil;
import com.zhongkeruan.common.utils.SnowFlakeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author yangyao
 * @Description: 用户微服务
 * @date 2019/1/9 11:14
 */
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableFeignClients
@EnableHystrix
@EnableTransactionManagement
public class UserApplication {
    private static Logger logger = LoggerFactory.getLogger(UserApplication.class);
    public static void main(String[] args) {
        SpringApplication.run(UserApplication.class, args);
        logger.info("「「「「「用户微服务启动完成」」」」」");
    }

    /**
     * token工具类
     * @return
     */
    @Bean
    public JwtUtil jwtUtil(){
        return new JwtUtil();
    }

    /**
     * 分布式id
     * @return
     */
    @Bean
    public SnowFlakeUtil snowFlakeUtil(){
        return new SnowFlakeUtil(1,1);
    }


}
